package com.thy.controller;


import com.hospital.common.base.PageResult;
import com.hospital.common.base.Result;
import com.hospital.common.dto.audit.module.SaveLogDto;
import com.hospital.common.vo.audit.module.AdminVo;
import com.hospital.common.vo.audit.module.AuitLogVo;
import com.thy.service.TAuitLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 审核记录表 前端控制器
 * </p>
 *
 * @author author
 * @since 2025-09-28
 */
@RestController
@RequestMapping("/auditLog")
public class TAuitLogController {
    @Autowired
    private TAuitLogService tAuitLogService;

    /**
     * 获取所有日志
     * @return PageResult<AuitLogVo>
     */
    @GetMapping("/getAllLog")
    public Result<PageResult<AuitLogVo>> getAllLog(@RequestParam("pageNum") Integer pageNum,@RequestParam("pageSize") Integer pageSize, @RequestParam("adminId") Long adminId){
        PageResult<AuitLogVo> pageResult = tAuitLogService.getAllLog(pageNum, pageSize, adminId);
        return Result.success(pageResult);
    }

    /**
     * 获取所有管理员
     * @return List<AdminVo>
     */
    @GetMapping("/getAllAdmin")
    public Result<List<AdminVo>> getAllAdmin(){
        List<AdminVo> adminVos = tAuitLogService.getAllAdmin();
        return Result.success(adminVos);
    }

    /**
     * 保存板块操作日志
     * @param saveLogDto
     * @return
     */
    @PostMapping("/saveSectionLog")
    public Result<?> saveSectionLog(@RequestBody SaveLogDto saveLogDto){
        tAuitLogService.saveSectionLog(saveLogDto);
        return Result.success();
    }
}
